cmake_minimum_required(VERSION 3.19)
project(ChatClient LANGUAGES CXX)

find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Widgets)
find_package(Qt6 REQUIRED COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core Widgets)
find_package(Qt6 REQUIRED COMPONENTS Widgets)

qt_standard_project_setup()

qt_add_executable(ChatClient
    WIN32 MACOSX_BUNDLE
    main.cpp
    mainwidget.cpp
    mainwidget.h
    modle/data.h
    rource.qrc
    sessionfriendarea.h sessionfriendarea.cpp
    debug.h
    messageshowarea.h messageshowarea.cpp
    messageeditarea.h messageeditarea.cpp
    messageitem.h messageitem.cpp
    personinforshow.h personinforshow.cpp
    userinforwidget.h userinforwidget.cpp
    privatechatsesiondetail.h privatechatsesiondetail.cpp
    qpushbuttonandqlael.h qpushbuttonandqlael.cpp
    selectfriendarea.h selectfriendarea.cpp
    selectfriendscrollarea.h selectfriendscrollarea.cpp
    selectfrienditem.h selectfrienditem.cpp
    groupchatsessiondetail.h groupchatsessiondetail.cpp
    addfrienddialog.h addfrienddialog.cpp
    historymessagedialog.h historymessagedialog.cpp
    loginandregisterdialog.h loginandregisterdialog.cpp


)

qt_add_resources(
    ChatClient
    PREFIX "/"
    FILES
    Resources
)

target_link_libraries(ChatClient
    PRIVATE
        Qt::Core
        Qt::Widgets
)
target_link_libraries(ChatClient PRIVATE Qt6::Core Qt6::Widgets)
target_link_libraries(ChatClient PRIVATE Qt6::Widgets)
target_link_libraries(ChatClient PRIVATE Qt6::Widgets)
target_link_libraries(ChatClient PRIVATE Qt6::Widgets)
target_link_libraries(ChatClient PRIVATE Qt6::Widgets)
target_link_libraries(ChatClient PRIVATE Qt6::Widgets)
target_link_libraries(ChatClient PRIVATE Qt6::Core Qt6::Widgets)
target_link_libraries(ChatClient PRIVATE Qt6::Widgets)

include(GNUInstallDirs)

install(TARGETS ChatClient
    BUNDLE  DESTINATION .
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

qt_generate_deploy_app_script(
    TARGET ChatClient
    OUTPUT_SCRIPT deploy_script
    NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
